package com.docwei.thansgank.fragment;


import android.support.v4.app.Fragment;

/**
 * Created by tobo on 17/7/26.
 */
public abstract class BaseFragement extends Fragment {
    protected boolean isVisible=false;
    protected boolean isStart=false;

    @Override
    public void setUserVisibleHint(boolean isVisibleToUser) {
        super.setUserVisibleHint(isVisibleToUser);
        if(isVisibleToUser){
            isVisible=isVisibleToUser;
            if(isVisible&&isStart){
                pullData();
                isStart=false;
            }
        }else{
            isVisible = false;
        }
    }
    protected abstract void pullData();

    @Override
    public void onStart() {
        super.onStart();
        isStart=true;
        if(isVisible&&isStart){
            pullData();
            isStart=false;
        }
    }
}
